/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.manage.convertor;

import info.peigen.hotpot.manage.core.domain.Resource;
import info.peigen.hotpot.manage.core.manage.form.ResourceCreateForm;
import info.peigen.hotpot.manage.core.manage.form.ResourceEditForm;
import info.peigen.hotpot.manage.core.manage.form.ResourceSearchForm;
import info.peigen.hotpot.manage.core.repository.entity.ResourceEntity;
import info.peigen.hotpot.manage.core.service.order.ResourceCreateOrder;
import info.peigen.hotpot.manage.core.service.order.ResourceEditOrder;
import info.peigen.hotpot.manage.core.service.result.info.ResourceInfo;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * <b>(ResourceManageConvertor)</b>
 * 管理后台领域对象 "资源" 转换器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-08-05
 */
@SuppressWarnings("unused")
@Mapper(builder = @Builder(disableBuilder = true))
public interface ResourceManageConvertor {
    ResourceManageConvertor INSTANCE = Mappers.getMapper(ResourceManageConvertor.class);

    // ConvertToEntity
    ResourceEntity convertToEntity(Resource domain);

    List<ResourceEntity> convertToEntitiesByDomain(List<Resource> domains);

    ResourceEntity convertToEntity(ResourceInfo resourceInfo);

    List<ResourceEntity> convertToEntitiesByInfo(List<ResourceInfo> resourceInfo);

    ResourceEntity convertToEntity(ResourceSearchForm form);

    ResourceEntity convertToEntity(ResourceCreateForm form);

    ResourceEntity convertToEntity(ResourceEditForm form);

    // ConvertToDomain
    Resource convertToDomain(ResourceEntity entity);

    List<Resource> convertToDomainsByEntity(List<ResourceEntity> entities);

    Resource convertToDomain(ResourceInfo resourceInfo);

    List<Resource> convertToDomainsByInfo(List<ResourceInfo> infos);

    Resource convertToDomain(ResourceSearchForm form);

    Resource convertToDomain(ResourceCreateForm form);

    Resource convertToDomain(ResourceEditForm form);

    // ConvertToInfo
    ResourceInfo convertToInfo(Resource domain);

    List<ResourceInfo> convertToInfosByDomain(List<Resource> domains);

    ResourceInfo convertToInfo(ResourceEntity entity);

    List<ResourceInfo> convertToInfosByEntity(List<ResourceEntity> entities);

    ResourceInfo convertToInfo(ResourceSearchForm form);

    ResourceInfo convertToInfo(ResourceCreateForm form);

    ResourceInfo convertToInfo(ResourceEditForm form);

    // ConvertOrder
    ResourceCreateOrder convertToCreateOrder(ResourceCreateForm form);

    ResourceEditOrder convertToEditOrder(ResourceEditForm form);
}